Skip to main content

Makefile Tasks for FNZ Development Environment

This document explains each task defined in the Makefile, including hidden and helper tasks. Use this as a reference for setting up, running, and managing your development environment.


Table of Contents


Note: All make targets beginning with a . are hidden helper tasks and are not meant to be run directly. They are typically used within other tasks.


General Tasks

default

  • Description: Launches the development environment by entering the devbox shell.
  • Usage: make
  • Notes: This is the default task and will run if you use make without specifying a target.

launch

  • Description: Complete setup for the development environment.
  • Usage: make launch
  • Steps:
    • Installs all npm dependencies.
    • Brings up the Docker containers using make .up.
    • Migrates and seeds the database using make .seed-db.
    • Prints a welcome message to indicate the environment is ready.

dev-backend

  • Description: Runs the backend in development mode.
  • Usage: make dev-backend
  • Notes: Uses lerna to run backend development tasks within the @fnz/backend scope.

dev-frontend

  • Description: Runs the frontend in development mode.
  • Usage: make dev-frontend
  • Notes: Uses lerna to run frontend development tasks within the @fnz/frontend scope.

dev-docs

  • Description: Runs the documentation server in development mode.
  • Usage: make dev-docs
  • Notes: Uses lerna to run the documentation tasks within the @fnz/docs scope.

dev-all

  • Description: Runs backend, frontend, and documentation servers simultaneously.
  • Usage: make dev-all
  • Notes: Prefer running each command separately (dev-backend, dev-frontend, and dev-docs) to view logs more clearly.

Docker Management Tasks

down

  • Description: Tears down all Docker containers and prunes Docker volumes.
  • Usage: make down
  • Notes: This will stop all containers and clean up volumes, which may be helpful if you encounter issues or need a fresh start.

.up (Helper Task)

  • Description: Builds and starts Docker containers in detached mode, waiting until they’re fully ready.
  • Usage: make .up
  • Notes: This helper task is used internally by the launch task but should not be run directly.

Database Management

proxy-db

  • Description: Proxies to the remote database at port 15432 on the local machine.
  • Usage: make proxy-db
  • Notes: Useful for connecting directly to the database with tools like psql or GUI clients.

.seed-db (Helper Task)

  • Description: Runs database migrations and seeds the database.
  • Usage: make .seed-db
  • Steps:
    • Executes db:migrate-dev within the @fnz/backend scope with concurrency set to 5.
    • Indicates when migration and seeding are complete.
  • Notes: This task is run automatically in launch but should not be run directly.

Cleanup Tasks

clean

  • Description: Removes all node_modules and package-lock.json files.
  • Usage: make clean
  • Notes: Useful for resetting dependencies if you encounter issues with installed packages.

Execution Order

For setting up your environment, follow these steps:

  1. Run make launch to install dependencies, start Docker containers, and set up the database.
  2. To work on individual components:
    • Run make dev-backend for the backend.
    • Run make dev-frontend for the frontend.
    • Run make dev-docs for documentation.
  3. Use make dev-all to run all components together, but note that logs may be easier to follow when running components separately.
  4. For cleanup, use make down to stop Docker containers or make clean to remove node_modules.

Troubleshooting

  • If Docker containers fail to start or services don’t connect, try using make down and then re-run make launch.
  • For dependency-related issues, use make clean and re-run npm install or make launch.

This guide provides a comprehensive overview of the Makefile tasks for setting up and managing the FNZ development environment.